
import { test, expect } from '@playwright/test';

test('test', async ({ page }) => {

  // Go to http://192.168.8.104/
  await page.goto('http://192.168.8.104/');

  // Click [placeholder="请输入用户名"]
  await page.locator('[placeholder="请输入用户名"]').click();

  // Fill [placeholder="请输入用户名"]
  await page.locator('[placeholder="请输入用户名"]').fill('admin');

  // Click [placeholder="请输入密码"]
  await page.locator('[placeholder="请输入密码"]').click();

  // Fill [placeholder="请输入密码"]
  await page.locator('[placeholder="请输入密码"]').fill('104');

  // Click input:has-text("登录")
  await page.locator('input:has-text("登录")').click();
  await expect(page).toHaveURL('http://192.168.8.104/jsp/portal/index.jsp#TopMenu=0&LeftMenu=0&Tree=-1');

  // Click text=修改密码this is a Window Dialog,Write by Witson. >> div >> nth=3
  await page.locator('text=修改密码this is a Window Dialog,Write by Witson. >> div').nth(3).click();

  // Click #idxNavItem_Tip td >> nth=0
  await page.locator('#idxNavItem_Tip td').first().click();
  await expect(page).toHaveURL('http://192.168.8.104/jsp/portal/index.jsp#TopMenu=1&LeftMenu=0&Tree=-1');

  // Click text=用户管理
  await page.locator('text=用户管理').click();
  await expect(page).toHaveURL('http://192.168.8.104/jsp/portal/index.jsp#TopMenu=1&LeftMenu=0&Tree=9a3a1be3d1b64939a2f00c54b33bd474');

  // Click text=xurong >> nth=0
  await page.frameLocator('iframe[name="frameMain"]').locator('text=xurong').first().click();

  // Click input[name="EMPLOYER_NUMBER"]
  await page.frameLocator('iframe[name="jt_Window_2214824"]').locator('input[name="EMPLOYER_NUMBER"]').click();

  // Click input[name="USER_LOGIN_NAME"]
  await page.frameLocator('iframe[name="jt_Window_2214824"]').locator('input[name="USER_LOGIN_NAME"]').click();

  // Fill input[name="USER_LOGIN_NAME"]
  await page.frameLocator('iframe[name="jt_Window_2214824"]').locator('input[name="USER_LOGIN_NAME"]').fill('徐蓉1');

  // Click input[name="USER_LOGIN_NAME"]
  await page.frameLocator('iframe[name="jt_Window_2214824"]').locator('input[name="USER_LOGIN_NAME"]').click();

  // Click text=保存
  await page.frameLocator('iframe[name="jt_Window_2214824"]').locator('text=保存').click();

  // Click text=用户管理this is a Window Dialog,Write by Witson. >> div >> nth=3
  await page.locator('text=用户管理this is a Window Dialog,Write by Witson. >> div').nth(3).click();

  // Click text=注销
  await page.locator('text=注销').click();
  await expect(page).toHaveURL('http://192.168.8.104/sso/login.action');

});